//
//  MTPaymentModel.swift
//  MT
//
//  Created by ooops on 2020/3/17.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation


import Foundation
import ObjectMapper
import MTCategory

class MTPaymentModel: Mappable {
    
    /// 请求是否成功的code
    var code: Int?
    /// 请求返回的Message
    var message: String?
    /// 分页对象
    var page: PageModel?
    /// 时间戳
    var timestamp: TimeInterval?
    /// 账户总金额
    var ticketAmount: Int?
    
    var result: [MTPaymentResultModel]?
    
    var appleResult: [MTApplePaymentResultModel]?
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        code    <- map["code"]
        message <- map["message"]
        page <- map["page"]
        timestamp <- map["timestamp"]
        result  <- map["result"]
        appleResult <- map["result"]
        ticketAmount <- map["ticketAmount"]
        
    }
}

class MTPaymentResultModel: Mappable {
    
    /// 商品id
    var id: Int?
    /// 金币数量
    var money: Int?
    /// 奖励金额
    var reward: Int?
    /// 人民币金额
    var rmbAmount: Double?
    
    var isSelected: Bool = false
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        id    <- map["id"]
        money <- map["money"]
        reward <- map["reward"]
        rmbAmount <- map["rmbAmount"]
    }
}

class MTApplePaymentResultModel: Mappable {
    
    /// 商品id
    var id: Int?
    /// 内购内部充值
    var innerPrice: Double?
    /// 内购价格
    var price: Double?
    /// 苹果内购id
    var code: String?
    /// 是否选中
    var isSelected: Bool = false
    
    required public init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        id    <- map["id"]
        innerPrice <- map["innerPrice"]
        price <- map["price"]
        code <- map["code"]
    }
}
